package bishi2016;

import java.util.Scanner;

public class Baidu_TransportPeople {

	//运行时间：225ms
	//占用内存：3917k
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		while (scanner.hasNext()) {
			int counts = scanner.nextInt();
			int maxCrime = scanner.nextInt();
			int transPeoples = scanner.nextInt();
			int[] crimes = new int[counts]; // crime value
			for (int i = 0; i < crimes.length; i++) {
				crimes[i] = scanner.nextInt();
			}
			getCount(crimes, transPeoples, maxCrime);
		}
		scanner.close();
	}
	
	public static void getCount(int[] crimes, int transPeoples, int maxCrime){
		if(crimes == null || crimes.length <= 0){
			return ;
		}
		int curCrimes = 0, counts = 0;
        //显然这里还有很多可以优化的地方
        //每次我们都是重新计算i + 1  ---->  i + 1 + transpeople;
        //但是我们其实已经知道了i -----> i + transpeople 
        //只要减掉头，然后加上尾即可
        for(int i = 0; i < transPeoples; i++){
            curCrimes += crimes[i]; 
        }
        if(curCrimes <= maxCrime){
            counts++;
        }
        // 注意这里的i表示以最后一个罪犯以i结尾
		for (int i = transPeoples; i <crimes.length; i++) {
			curCrimes = curCrimes + crimes[i] - crimes[i - transPeoples]; 
            if(curCrimes <= maxCrime){
                counts++;
            }
		}
		System.out.println(counts);
	}
}
